﻿using Amazon.SQS;
using NUnit.Framework;
using Rhino.Mocks;
using ShuttleBus.Transports.AmazonSqs;

namespace Tests.Transports.AmazonSqs.SqsTests
{
    public partial class SqsTests
    {
        [TestFixture]
        public class WhenDisposing
        {
            private Sqs _queue;
            private AmazonSQS _sqsClient;

            [SetUp]
            public void SetUp()
            {
                _sqsClient = MockRepository.GenerateMock<AmazonSQS>();
            }

            [TearDown]
            public void TearDown()
            {
                _sqsClient.VerifyAllExpectations();
            }

            [Test]
            public void DisposesOfUnderlyingQueue()
            {
                _queue = new Sqs(_sqsClient, null, 0);
                _sqsClient.Expect(s => s.Dispose());

                _queue.Dispose();
            }
        }
    }
}